class BoxItemUI extends BaseComp{
    private lb_name:eui.Label;
    private item:eui.Group;
    private img_icon:eui.Image;
    constructor(data?)
    {
        super('BoxItem', data)
    }

    public init()
    {
        if(this.data)
        {
            this.img_icon.source = this.data.icon;
            this.img_icon.width = this.img_icon.height = 110;
            this.lb_name.text = this.data.name;
        }
    }

    public addEvent()
    {
        this.item.addEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandle, this);
    }

    public touchHandle()
    {
        if(this.data)
        {
            let appid = this.data.appid;
            EffectUtil.instance().playBtnEffect(this.item);
            egret.Tween.get(this).wait(200).call(()=>{
                WeChatgGameManager.instance().navigateToMiniProgram(appid);
            });
        }
    }

    public removeEvent()
    {
        this.item.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.touchHandle, this);
    }

    public clear()
    {
        
    }
}